#include <all_wlib.h>
#pragma hdrstop
//#pragma package(smart_init)
#pragma resource "*.dfm"

#include "int.h"
#include "oz_Cfg.h"

bool Configure( TForm *Owner )
  {  HAutoPtr<TOziCfgForm> d( new TOziCfgForm(Owner) );
 return d->ShowModal();
}

//---------------------------------------------------------------------------
__fastcall TOziCfgForm::TOziCfgForm(TComponent* Owner)
    : TForm(Owner)
  {
     HLoadFormPos( Opt->Key->ConfigGetCreate("Config"), this );

    //cfg -> Fields
     btnTHeight->Position = GOPT( "TitleHeight", 20 );

     octConnectType ct = (octConnectType) GOPT( "Connect/Type", octOzi );
     if ( ct == octFile ) chConnectFile->Checked = true; else
     if ( ct == octPort ) chConnectPort->Checked = true; else
       chConnectOzi->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TOziCfgForm::btnOKClick(TObject *Sender)
  {
     HSaveFormPos( Opt->Key->ConfigGetCreate("Config"), this );

    //Fields -> cfg
     SOPT( "TitleHeight", btnTHeight->Position );

     octConnectType ct;
     if ( chConnectFile->Checked ) ct = octFile; else
     if ( chConnectPort->Checked ) ct = octPort; else
       ct = octOzi;
     SOPT( "Connect/Type", ct );
}
//---------------------------------------------------------------------------
